package day0911.demo1;

import java.util.Objects;

/**
 * @Author:galaxy_yan
 * @Date: 2022/9/11
 * @Time: 20:34
 * @Description
 */
public class Student implements Comparable<Student>{

    private String name;
    private int score;

    public Student(String name, int score) {
        this.name = name;
        this.score = score;
    }

    @Override
    public String toString() {
        return "["+this.name+","+this.score+"]";
    }

    @Override
    public int compareTo(Student o) {
        Student stu = (Student)o;
        if(this.score> stu.score){
            return -1;
        }else if(this.score< stu.score){
            return 1;
        }else{
            return 0;
        }
    }
}
